<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

    <button>点击</button>

<script>
    const btn = document.querySelector("button")

    btn.addEventListener("click", function() {
        alert("按钮被点击了")
    })
</script>
    
</body>
</html>